package acm.蓝桥4;

import java.util.Scanner;

public class 阴间题意 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int T = sc.nextInt();
        sc.nextLine();
        while (T-- > 0) {
            String[] a = sc.nextLine().split(" ");
            String[] b = sc.nextLine().split(" ");
            long atime =get(a[1])-get(a[0])+(a.length>2?add(a[2]):0);
            long btime =get(b[1])-get(b[0])+(b.length>2?add(b[2]):0);
            long res=(btime+atime)/2;
            System.out.println(toTime(res));
        }
    }
    public static String toTime(long time) {
        StringBuilder builder = new StringBuilder();
        long h = time/3600;
        builder.append(String.format("%02d",h)).append(":");
        long m = (time%3600)/60;
        builder.append(String.format("%02d",m)).append(":");
        long s = time%60;
        builder.append(String.format("%02d",s));
        return builder.toString();
    }
    public static long get(String line) {
        long time = 0;
        String[] split = line.split(":");
        time+=Integer.parseInt(split[2]);
        time+=Integer.parseInt(split[1])*60;
        time+=Integer.parseInt(split[0])*60*60;
        return time;
    }
    public static long add(String line){
        long time = 0;
        time=line.charAt(line.length()-2)-'0';
        time*=24*60*60;
        return time;
    }
}
